package com.sxt.springcloud.sys;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sxt.springcloud.sys.fallback.RoleClientFallbackService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import com.sxt.sys.domain.Permission;
import com.sxt.sys.domain.Role;
import com.sxt.sys.vo.RoleVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
@FeignClient(value = "SPRINGCLOUD-PROVIDER-SYS",fallbackFactory = RoleClientFallbackService.class)
@RequestMapping("/p/role")
public interface RoleClientService {




    /**
     * 查询
     */
    @RequestMapping("loadAllRole")
    DataGridView loadAllRole(@RequestBody RoleVo roleVo);

    /**
     * 添加
     */
    @RequestMapping("addRole")
    ResultObj addRole(@RequestBody RoleVo roleVo);
    /**
     * 修改
     */
    @RequestMapping("updateRole")
    ResultObj updateRole(@RequestBody RoleVo roleVo);

    /**
     * 删除
     */
    @RequestMapping("deleteRole")
    ResultObj deleteRole(@RequestParam("id") Integer id);


    /**
     * 根据角色ID加载菜单和权限的树的json串
     */
    @RequestMapping("initPermissionByRoleId")
    DataGridView initPermissionByRoleId(@RequestParam("roleId") Integer roleId);

    /**
     * 保存角色和菜单权限之间的关系
     */
    @RequestMapping("saveRolePermission")
    ResultObj saveRolePermission(@RequestParam("rid") Integer rid,@RequestParam("ids")Integer[] ids);

}
